<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta name="Content-Type" content="text/html; charset=UTF-8" />
<title>File: FAQ</title>
<link rel="stylesheet" href="style.css" tppabs="http://sass-lang.com/docs/yardoc/css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="common.css" tppabs="http://sass-lang.com/docs/yardoc/css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>
<script type="text/javascript" charset="utf-8" src="jquery.js" tppabs="http://sass-lang.com/docs/yardoc/js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="app.js" tppabs="http://sass-lang.com/docs/yardoc/js/app.js"></script>

  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html" tppabs="http://sass-lang.com/docs/yardoc/_index.html" title="Index">Index</a> &raquo; 
    <span class="title">File: FAQ</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="..htm" tppabs="http://sass-lang.com/docs/yardoc/." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  <a id="class_list_link" href="#">Class List</a>
  <a id="method_list_link" href="#">Method List</a>
  <a id ="file_list_link" href="#">File List</a>
</div>

      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><div id='filecontents'><h1 id='frequently_asked_questions'>Frequently Asked Questions</h1>
<div class='maruku_toc'><ul style='list-style: none;'><li><a href='#frequently_asked_questions'>Frequently Asked Questions</a><ul style='list-style: none;'><li><a href='#q-ruby-code'>Can I use a variable from my controller in my Sass file?</a></li></ul></li><li><a href='#you_still_havent_answered_my_question'>You still haven&#8217;t answered my question!</a></li></ul></div>
<h2 id='q-ruby-code'>Can I use a variable from my controller in my Sass file?</h2>

<p>No. Sass files aren&#8217;t views. They&#8217;re compiled once into static CSS files, then left along until they&#8217;re changed and need to be compiled again. Not only don&#8217;t you want to be running a full request cycle every time someone requests a stylesheet, but it&#8217;s not a great idea to put much logic in there anyway due to how browsers handle them.</p>

<p>If you really need some sort of dynamic CSS, you can define your own <tt><a href="Functions.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html" title="Sass::Script::Functions (module)">Sass functions</a></tt> using Ruby that can access the database or other configuration. <em>Be aware when doing this that Sass files are by default only compiled once and then served statically.</em></p>

<p>If you really, really need to compile Sass on each request, first make sure you have adequate caching set up. Then you can use <tt><a href="Engine.html" tppabs="http://sass-lang.com/docs/yardoc/Sass/Engine.html" title="Sass::Engine (class)">Sass::Engine</a></tt> to render the code, using the <a href="file.SASS_REFERENCE.html#custom-option" tppabs="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#custom-option" title="&lt;code&gt;:custom&lt;/code&gt; option"><code>:custom</code> option</a> to pass in data that <tt><a href="EvaluationContext.html#options-instance_method" tppabs="http://sass-lang.com/docs/yardoc/Sass/Script/Functions/EvaluationContext.html#options-instance_method" title="Sass::Script::Functions::EvaluationContext#options (method)">can be accessed</a></tt> from your Sass functions.</p>

<h1 id='you_still_havent_answered_my_question'>You still haven&#8217;t answered my question!</h1>

<p>Sorry! Try looking at the <a href="file.SASS_REFERENCE.html" tppabs="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html">Sass</a> reference, If you can&#8217;t find an answer there, feel free to ask in <code>#sass</code> on irc.freenode.net or send an email to the <a href="javascript:if(confirm(%27http://groups.google.com/group/sass-lang  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://groups.google.com/group/sass-lang%27" tppabs="http://groups.google.com/group/sass-lang">mailing list</a>.</p></div></div>
    
    <div id="footer">
  Generated on Fri Mar  8 20:33:26 2013 by 
  <a href="javascript:if(confirm(%27http://yardoc.org/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://yardoc.org/%27" tppabs="http://yardoc.org/" title="Yay! A Ruby Documentation Tool">yard</a>
  0.5.3 (ruby-1.8.7).
</div>


  <script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  </script>
  <script type="text/javascript">
  try {
  var pageTracker = _gat._getTracker("UA-535380-8");
  pageTracker._trackPageview();
  } catch(err) {}</script>


  </body>
</html>